package com.itheima;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/hello")
public class controller {


    @RequestMapping("/show")
    @PreAuthorize("hasRole('ROLE_ADMIN')")
    public void annoTest() {
        System.out.println("hello");
    }

    @RequestMapping("/add")
    @PreAuthorize("hasAuthority('add')")
    public void add() {
        System.out.println("try to add");
    }


    @RequestMapping("/update")
    @PreAuthorize("hasAuthority('update')")
    public void update() {
        System.out.println("try to update");
    }
}
